import request from '@/utils/request'
import type {
  DailyRecomResponse,
  DeleteDailyRecomResponse,
  CitySearchResponse,
  UploadDailyRecomResponse,
  UploadDailyRecomData,
} from '@/type/daily-recom'

// 获取每日推荐
export const getDailyRecomAPI = (page: number): Promise<DailyRecomResponse> => {
  return request.get('/apif/gainDailyRecom', { params: { page } })
}

// 删除每日推荐
export const deleteDailyRecomAPI = (id: string): Promise<DeleteDailyRecomResponse> => {
  return request.delete('/apif/deleteDailyRecom', { data: { _id: id } })
}

// 远程搜索城市
export const searchCityOptionsAPI = (keywords: string): Promise<CitySearchResponse> => {
  return request.get('/apif/china-data', { params: { keywords } })
}

//上传每日推荐
export const uploadDailyRecomAPI = (
  data: UploadDailyRecomData,
): Promise<UploadDailyRecomResponse> => {
  return request.post('/apif/dailyRecom', data)
}
